Capturing an event

back to section start!

 
  OK, now we start waiting for the user to do something, when they do a 
message packet will arrive. 
 
  1do until event = 'inactive' 
  2  if waitpkt(handlername) then do 
  3 
  4    packet = getpkt(handlername) 
  5    if packet ~= '00000000'x then do 
  6 
  7      event = getarg(packet,0) 
  8      handle = getarg(packet,1) 
  9      namestr = getarg(packet,2) 
 10      user = getarg(packet,3) 
 11      pathstr = getarg(packet,4) 
 12      qualifier = getarg(packet,6) 
 13      deststr = getarg(packet,7) 
 14 
 15      if newopus then 
 16        lister wait thishandle quick 
 17      else do 
 18        lister query thishandle busy 
 19        if result = 1 then call delay(10) 
 20        end 
 
Line: 
 1      An event of inactive means that the lister has been closed, so we 
        loop around waiting for it to happen. 
 2      This is where there script usually 'parks' waiting for a message 
        packet, when a packet arrives this statement becomes true and the 
        script continues. 
 4      We get the message packet in variable packet. 
 5      If it isn't a null packet we continue, otherwise we would end up 
        waiting for a real packet at line 2 again. 
 7 - 13 We get the arguments from the packet, assigning them to variables. 
15 - 20 We see if the lister is busy, if it's a late version of Opus we can 
        use  lister wait , if it isn't then we use  lister query busy  
        command. 
 

DOpus PLUS - giving you that bit extra...